var http = require('http');

var server = http.createServer();

server.on('request', function (req, res) {
	var url = req.url;
	if (url === '/plain') {
		//text/plain普通文本
		res.setHeader('Content-Type', 'text/plain; charset=utf-8');
		res.end('hello 世界');
	} else if (url === '/html') {
		//发送html格式返回客户端
		res.setHeader('Content-Type', 'text/html; charset=utf-8');
		res.end('<p>hello html<a href="">点我</a></p>');
	}
});
server.listen(3000, function () {
	console.log('Server is running...');
});
